package com.example.listener;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContext;
import com.example.model.Dog;


public class MyContextListener implements ServletContextListener{
	public void contextInitialized(ServletContextEvent event){
		ServletContext context = event.getServletContext();
		String breed = context.getInitParameter("breed");
		Dog dog = new Dog(breed);
		context.setAttribute("dog", dog);
	}
	
	public void contextDestroyed(ServletContextEvent event){
		event.getServletContext().removeAttribute("dog");
	}
}